﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PersonalWebsite.Domain.Abstract.Configuration;
using PersonalWebsite.Domain.Entities.Website;

namespace PersonalWebsite.Domain.Configurations.Website;

public class WS_BookConfiguration : BaseConfiguration<WS_Book>
{
    public override void Configure(EntityTypeBuilder<WS_Book> builder)
    {
        builder.ToTable(nameof(WS_Book));

        builder.Property(c => c.Name).HasComment(comment: "名称").IsRequired().HasMaxLength(20);
        builder.Property(c => c.Author).HasComment("作者").IsRequired().HasMaxLength(20);
        builder.Property(c => c.Cover).HasComment("项目图片").HasMaxLength(1000).IsUnicode(false).IsRequired(true);
        builder.Property(c => c.Content).HasComment("内容").HasMaxLength(500);
        builder.Property(c => c.Brief).HasComment("简介").HasMaxLength(500);

        base.Configure(builder);
    }
}
